import { PrismaClient } from '@prisma/client'

const prisma = new PrismaClient()

async function main() {
  // 创建测试事件库
  const library = await prisma.eventLibrary.create({
    data: {
      name: "中国古代史",
      description: "重要历史事件集合",
      events: {
        create: [
          {
            title: "秦始皇统一中国",
            date: new Date("0221-01-01"),
            description: "秦始皇统一六国，建立中国第一个统一的封建王朝"
          },
          {
            title: "汉武帝即位",
            date: new Date("0141-01-01"),
            description: "汉武帝刘彻开创大汉盛世"
          },
          {
            title: "三国鼎立",
            date: new Date("0220-01-01"),
            description: "魏蜀吴三国形成鼎立之势"
          },
          {
            title: "隋朝统一中国",
            date: new Date("0589-01-01"),
            description: "隋文帝杨坚统一南北朝"
          },
          {
            title: "唐朝建立",
            date: new Date("0618-01-01"),
            description: "李渊建立唐朝"
          },
          // 添加更多事件...
        ]
      }
    }
  })

  console.log('添加测试数据成功')
}

main()
  .catch((e) => {
    console.error(e)
    process.exit(1)
  })
  .finally(async () => {
    await prisma.$disconnect()
  }) 